package com.tangtang.core.crypt;

import com.javafx.tools.doclets.internal.toolkit.util.DocFinder;
import org.apache.commons.codec.binary.Base64;

/**
 * Created by yuanyue on 15/7/26.
 */
public class Base64Util {
    /**
     * BASE64解密
     *
     * @param key the String to be decrypted
     * @return byte[] the data which is decrypted
     * @throws Exception
     */
    public static byte[] decodeBase64(String key) {
        return Base64.decodeBase64(key);
    }

    /**
     * BASE64加密
     *
     * @param key the String to be encrypted
     * @return String the data which is encrypted
     * @throws Exception
     */
    public static String encodeBase64String(byte[] key) {
        return Base64.encodeBase64String(key);
    }


    /**
     * BASE64加密
     *
     * @param key
     * @return
     */
    public static byte[] encodeBase64(byte[] key) {
        return Base64.encodeBase64(key);
    }


    /**
     * encodeBase64URLSafeString
     *
     * @param key String the data which is encrypted
     * @return
     */
    public static String encodeBase64URLSafeString(byte[] key) {
        return Base64.encodeBase64URLSafeString(key);
    }
}
